//类成员运算符重载
#include <iostream>
#include <string.h>
using namespace std;

class Time 
{
    int hour;
    int minute;
    int second;
public:
    Time(int h=0, int m=0, int s=0):hour(h),minute(m),second(s){}

    //加法运算符操作函数重载（t1+t2）
    const Time operator+(const Time &r);

    //显示时间
    void show();
    
};

const Time Time :: operator+(const Time &r)
{
    Time tmp;
    tmp.second = this->second +r.second;
    if(tmp.second >= 60)
    {
        tmp.minute++;
        tmp.second -= 60;
    }

    tmp.minute += this->minute + r.minute;
    if(tmp.minute >= 60)
    {
        tmp.hour++;
        tmp.minute -= 60;
    }

    tmp.hour += this->hour + r.hour;
    tmp.hour %= 24;
    return tmp;
}

void Time :: show()
{
    cout << hour << ":" << minute << ":" << second << endl;
}

int main(int argc, char const *argv[])
{
    Time t1(1,50,33);
    Time t2(0,20,43);
    Time t3;
    t3 = t1 + t2;
    t3.show();

    return 0;
}
